﻿namespace B.S.BasicData.Common
{
    /// <summary>
    /// 扩展类
    /// </summary>
    public static class Extensions
    {
        /// <summary>
        /// 扩展字符串转数字
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static int ToInt32(this string? value)
        {
            if(value==null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(value);
            }
        }
        /// <summary>
        /// 根据身份证计算出年月日
        /// </summary>
        /// <param name="cardId">身份证号</param>
        /// <returns></returns>
        public static string GetBirthByCardId(this string cardId)
        {
            string result = cardId.Substring(6, 8);
            return result;
        }




    }
}
